package com.sample.wanandroidx.ui.test

import cn.jzvd.Jzvd
import com.bumptech.glide.Glide
import com.sample.wanandroidx.basic.BaseActivity
import com.sample.wanandroidx.databinding.ActivityJzvdstdBinding

/**
 * 当前仅展示基础用法
 */
class JzvdStdActivity : BaseActivity<ActivityJzvdstdBinding>(ActivityJzvdstdBinding::inflate) {

    val title = "三生三世枕上书"

    override fun initialization() {
        setTitleStr(intent.getStringExtra("title"))
        binding.jzVideo.setUp("https://jzvd.nathen.cn/video/460bad24-170c5bc6956-0007-1823-c86-de200.mp4", title);
        Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/bd7ffc84-8407-4037-a078-7d922ce0fb0f.jpg")
            .into(binding.jzVideo.posterImageView)
        binding.jzVideo.startVideo()
    }


    override fun onBackPressed() {
        if (Jzvd.backPress()) {
            return
        }
        super.onBackPressed()
    }

    override fun onPause() {
        super.onPause()
        Jzvd.releaseAllVideos()
    }

}